支持不同人种的发音(老年人、男生、女生等)
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows.Forms;namespace TTS_Test{ public partial class Form1 : Form { private System.Media.SoundPlayer player; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { button1.Enabled = false; string c1 = "appid=4e9d1fa5"; TTS tts = new TTS(c1); tts.Finished = tts_Finished; tts.vol = enuVol.x_loud; tts.speed = enuSpeed.medium; tts.speeker = (enuSpeeker)comboBox1.SelectedIndex; tts.MultiSpeek(textBox1.Text, "audio.wav"); button1.Enabled = true; //player = new System.Media.SoundPlayer("audio.wav"); //player.Play(); } void tts_Finished(object sender, TTS.JinDuEventArgs e) { System.Diagnostics.Debug.WriteLine(e.AllP.ToString()); } private void Form1_Load(object sender, EventArgs e) { foreach (string s in Enum.GetNames(typeof(enuSpeeker))) comboBox1.Items.Add(s); comboBox1.SelectedIndex = 0; } private void button2_Click(object sender, EventArgs e) { Random rd = new Random(); int num = rd.Next(0, 4); label1.Text = num.ToString(); } }}
评论